<!DOCTYPE HTML>
<html>
<head>
    <include file="Common:header_include"/>
    <title>添加医疗资讯</title>
</head>
<body>
<div class="pd-20">
    <form action="{:U('add')}" method="post" class="form form-horizontal" id="form">
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red">*</span>标题：</label>
            <div class="formControls col-10">
                <input type="text" class="input-text" placeholder="请输入" name="title" nullmsg="不能为空">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red">*</span>医生：</label>
            <div class="formControls col-10">
                <span class="select-box">
                <select class="select" size="1" name="doctor_id" datatype="*" nullmsg="请选择">
                    <option value="" selected="" disabled="disabled">请选择</option>
                    <volist name=":getList('doctor')" id="v">
                        <option value="{$v.id}">{$v.name}</option>
                    </volist>
                </select>
                </span>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red"></span>&nbsp;图片:&nbsp;&nbsp;&nbsp;</label>
            <div class="formControls col-10">
                <input type="file" class="input-text" name="coverFile">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red">*</span>科室：</label>
            <div class="formControls col-10">
                <span class="select-box">
                <select class="select Validform_error" size="1" name="department_id" datatype="*" nullmsg="请选择" onchange="onchangeDepartment($(this))">
                    <option value="" selected="" disabled="disabled">请选择</option>
                    <volist name=":getDepartmentTree()" id="v">
                        <option value="{$v.id}"  <if condition="$v['department_id'] eq 0">disabled="disabled"</if>>{$v.title}</option>
                    </volist>
                </select>
                </span>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red">*</span>疾病：</label>
            <div class="formControls col-10">
                <span class="select-box">
                <select class="select Validform_error" size="1" name="disease_id" datatype="*" nullmsg="请选择">
                    <option value="" selected="" disabled="disabled" >请选择</option>
                    <volist name=":getDiseaseTree()" id="dis">
                        <option value="{$dis.id}">{$dis.title}</option>
                    </volist>
                </select>
                </span>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red"></span>关键词：</label>
            <div class="formControls col-7">
                <input type="text" class="input-text" placeholder="请输入" name="keyword" value="{$data.keyword}">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red">*</span>内容：</label>
            <div class="formControls col-10">
                <script id="content" name="content" type="text/plain" style="width:100%;height:400px;"></script>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <div class="col-11 col-offset-1">
                <input class="btn btn-primary radius" type="submit" value="提交">
            </div>
        </div>
    </form>
</div>
</div>
<include file="Common:footer_include"/>
</body>
<script type="text/javascript">
    $(function () {
        var ue = UE.getEditor('content');
    });
    //选择科室
    function onchangeDepartment(jqObj){
        var department_id = jqObj.val();
        var diseaseSelect = $('select[name="disease_id"]');
        diseaseSelect.html('');
        $.ajax({
            url: '{:U("Disease/getListJson")}?department_id=' + department_id,
            type: 'post',
            enctype: 'multipart/form-data',
            success: function (data) {
                if (data == false){
                    diseaseSelect.append("<option>暂无</option>");
                }else {
                    $.each(data, function (i, item) {
                        diseaseSelect.append('<option value="' + item.id + '" >' + item.title + '</option>');
                    });
                }
            }
        });
    }
</script>
</html>